package com.blog.controller;

import com.blog.annotation.SystemLog;
import com.blog.domain.ResponseResult;
import com.blog.domain.entity.User;
import com.blog.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserController {

	@Autowired
	private UserService userService;

	//查看个人信息
	@GetMapping("/userInfo")
	public ResponseResult userInfo(){

		return userService.userInfo();

	}

	/**修改个人信息
	 *
	 * @param user
	 * @return
	 */
	@PutMapping("/userInfo")
	@SystemLog(businessName = "更新用户信息")
	public ResponseResult updateUserInfo(@RequestBody User user){

		return userService.updateUserInfo(user);

	}

	/**注册
	 *
	 * @param user
	 * @return
	 */
	@PostMapping("/register")
	public ResponseResult register(@RequestBody User user){

			return userService.register(user);

	}
}
